package com.hdax.mappers;

import com.hdax.entity.Department;
import com.hdax.entity.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 部门映射器
 *
 * @author Aizen
 * @date 2022/05/05
 */
@Repository
@Mapper
public interface DepartmentMapper {

    /**
     * 查询所有部门
     * @return
     */
    List<Department> findAll();

    /**
     * 根据id查询
     * @param id
     * @return
     */
    Department findById(@Param("id") int id);

    /**
     * 添加部门
     *
     * @param department 部门
     * @return int
     */
    int addDepartment(Department department);

    /**
     * 根据员工id查询是否是项目经理
     * @param dperson
     * @return
     */
    List<Department> listAll(@Param("did")int dperson);

    /**
     * 更新部门
     * @param department
     * @return
     */
    Integer updateDepartment(Department department);
    /**
     * 删除部门
     * @param id
     * @return
     */
    Integer deleteDepartment(Integer id);
}
